<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        table {border-collapse: collapse; font-size: 14px; width: 80%; margin: auto}
        table, th, td {border: 1px solid darkslategray;padding: 10px}
    </style>
</head>
<body>
<div style="text-align: center">
    <span style="color: darkslategray; font-size: 30px">欢迎光临！</span>
    <hr/>
    <a th:href="@{/emp/toAdd/{type}(type=${type})}" th:if="${type==1 || type==0}">添加</a>
    <a th:href="@{/emp/toAddDept/{type}(type=${type})}" th:if="${type==0}">新增部门</a>
    <a th:href="@{/emp/toAddZhiWu/{type}(type=${type})}" th:if="${type==0}">新增职务</a>
    <table class="list">
        <tr>
            <th>id</th>
            <th>姓名</th>
            <th>性别</th>
            <th>出生日期</th>
            <th>入职日期</th>
            <th>学历</th>
            <th>职务</th>
            <th>地址</th>
            <th>电话</th>
            <th>紧急联系人</th>
            <th>所属部门</th>
            <th>编辑</th>
        </tr>
        <tr th:each="emp : ${empList}">
            <td th:text="${emp.id}"></td>
            <td th:text="${emp.name}"></td>
            <td th:text="${emp.sex}"></td>
            <td th:text="${#dates.format(emp.birth,'yyyy-MM-dd')}"></td>
            <td th:text="${#dates.format(emp.date,'yyyy-MM-dd')}"></td>
            <td th:text="${emp.xveli}"></td>
            <td th:text="${emp.zname}"></td>
            <td th:text="${emp.address}"></td>
            <td th:text="${emp.phone}"></td>
            <td th:text="${emp.phonex}"></td>
            <td th:text="${emp.dname}"></td>
            <td>
                <a th:href="@{/emp/toEdit/{id}/{type}(id=${emp.id},type=${type})}">修改</a>
                <a th:href="@{/emp/delete/{id}/{type}(id=${emp.id},type=${type})}" onclick="return confirm('确认删除？')" th:if="${type==0}">删除</a>
            </td>
        </tr>
    </table>
    <span style="color: darkslategray; font-size: 30px">部门列表</span>
    <table class="list">
        <tr>
            <th>id</th>
            <th>部门名称</th>
            <th>创建时间</th>
            <th>编辑</th>
        </tr>
        <tr th:each="dept : ${dList}">
            <td th:text="${dept.did}"></td>
            <td th:text="${dept.dname}"></td>
            <td th:text="${#dates.format(dept.createtime,'yyyy-MM-dd')}"></td>
            <td>
                <a th:href="@{/emp/deleteDept/{id}/{type}(id=${dept.did},type=${type})}" onclick="return confirm('确认删除？')" th:if="${type==0}">删除</a>
            </td>
        </tr>
    </table>
    <span style="color: darkslategray; font-size: 30px">职务列表</span>
    <table class="list">
        <tr>
            <th>id</th>
            <th>职务名称</th>
        </tr>
        <tr th:each="zhiwu : ${zList}">
            <td th:text="${zhiwu.zid}"></td>
            <td th:text="${zhiwu.zname}"></td>
        </tr>
    </table>
</div>

</body>
</html>